package com.example.sbmpdemo.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.sbmpdemo.pojo.Schedule;
import com.example.sbmpdemo.service.ScheduleService;
import com.example.sbmpdemo.mapper.ScheduleMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author Administrator
* @description 针对表【players】的数据库操作Service实现
* @createDate 2024-03-29 09:26:32
*/
@Service
public class ScheduleServiceImpl extends ServiceImpl<ScheduleMapper, Schedule> implements ScheduleService {
    @Autowired
    private ScheduleMapper scheduleMapper;

    @Override
    public List<Schedule> selectSysUserCount(Integer tripModeId) {
        QueryWrapper<Schedule> queryWrapper = new QueryWrapper<>();
        if(tripModeId != null)
            queryWrapper.eq("trip_mode_id",tripModeId);
        return scheduleMapper.selectList(queryWrapper);
    }

    @Override
    public int add(Schedule schedule) {
        return scheduleMapper.insert(schedule);
    }

    @Override
    public int delete(Integer id) {
        return scheduleMapper.deleteById(id);
    }

    @Override
    public int modify(Integer id, Integer status) {
        return scheduleMapper.modify(id,status);
    }
}




